{% extends "layouts/layout.html" %}
{% block title %}
Edit Item
{% endblock %}
{% block content %}
<h3>Edit Item</h3>
<hr />
<script type="text/javascript" src="/js/items/items.js"></script>
<form action="/items/update_item" id="item_form" enctype="multipart/form-data" method="post">
  <input type="hidden" name="item_id" value="{{ item.key().id() }}"/>
  <input type="hidden" name="xsrf_token" value="{{ xsrf_token }}"/>
	<div class="well">

		<p>
			Title*<br />
			<div class="input-prepend">
				<span class="add-on"><i class="icon-tag"></i></span>
				{{ sanitizeHTML('<input name="title" id="title" value="' + item.title + '" type="text" />') }}
			</div>
		</p>
		<p>
			Description<br />
			<textarea name="description" id="description" class="richtext">{{ item.description }}</textarea>
		</p>
		<p>
			Price*<br />
			<div class="input-prepend">
				<span class="add-on">$</span>
				<input name="price" id="price" type="text" value="{{ item.price }}">
			</div>
		</p>
    <p>
      Photo<br />
      <div class="input-prepend">
        <span class="add-on"><i class="icon-picture"></i></span>
        <input type="file" name="photo" style="padding-left: 5px;"/>
      </div>
    </p>
    <p>
      <label>
				Enable Bidding? 
				<i class="icon-info-sign info_button-right" title="Enable Bidding" data-content="If checked, then buyers can bid on your item."></i>
			</label>
			<input type="checkbox" name="bidding_enabled" {% if item.bidding_enabled %} checked="true" {% endif %} />
    </p>
    {% if current_li.is_admin %}
    <p>
        <label>
            Sponsor this item? 
            <i class="icon-info-sign info_button-right" title="Sponsor this item (Admin only)" data-content="If checked, then this item can be advertised by all apps."></i>
        </label>
        <input type="checkbox" name="sponsored" {% if item.sponsored %} checked="true" {% endif %} />
    </p>
    {% endif %}
    <p>
      {% if item.is_expired() %}
        This item is expired.
      {% elif not item.is_expired() %}
        <label>
            Is this item private? 
            <i class="icon-info-sign info_button-right" title="Make item private" data-content="If checked, item can only be viewed by you in your virtual shop."></i>
        </label>
        <input type="checkbox" name="show_item" {% if not item.is_active %} checked="true" {% endif %}/>
      {% endif %}
         

    </p>
	</div>
	<button class="btn btn-primary" type="submit" value="Save">Update Item</button>
	<a class="btn" href="/items/">Cancel</a>
</form>
{% endblock %}
